import request from '@/utils/request';

export async function getUBSPosition(params) {
  return request(`/fss/Position/UBSPosition?id=${params}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function upLoadPositionStocks(params) {
  return request(`/fss/Position/PositionUpload`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}

export async function getFssFundOptionsList(params) {
  return request(`/fss/OptionPosition/GroupOption`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(params),
  });
}
export async function getAssetManagement(params) {
  return request(`/fss/Position/AssetManagement`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    // body:JSON.stringify(params)
  });
}

// fu
export async function getFssFundOptionsListByStock(params) {
  return request(`/admin/ajax/data/FssFundOptionsList.ashx?stock=${params}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getGroupFu(param) {
  return request(`/fss/FundValue/GroupFu`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getWaitBuy(param) {
  return request(`/fss/Position/WaitBuy?state=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function addWaitBuy(param) {
  return request(`/fss/Position/AddWaitBuy?stock=${param.stock}&state=${param.state}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function deleteWaitBuy(param) {
  return request(`/fss/Position/DelWaitBuy?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function deleteAllWaitBuy(param) {
  return request(`/fss/Position/DelAllWaitBuy?state=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function stockIndustryPer(param) {
  return request(`/fss/Position/StockIndustryPer`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getFuGroupHeadETF() {
  return request(`/fss/Position/FuGroupHeadETF`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function addFuGroupHeadETF(param) {
  return request(`/fss/Position/AddFuGroupHeadETF?code=${param.code}&type=${param.type}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function deleteFuGroupHeadETF(param) {
  return request(`/fss/Position/DelFuGroupHeadETF?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function deleteFuGroupHeadETFAll() {
  return request('/fss/Position/Clear', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getRunPoints(param) {
  return request(`/fss/RunPoint/StockRunPoint?type=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getUBSNoTwoPosition(param) {
  return request('/fss/Position/UBSNoTwoPosition', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getFundTwoStockPosition() {
  return request('/fss/Position/FundTwoStockPosition', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

// nEWtWO
export async function getUBSNewTwoPosition(param) {
  return request('/fss/FundValue/NewTwoFund', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function updateFundTwoInfo(param) {
  return request('/fss/FundValue/UpdateFundTwoInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function getLastTrade(param) {
  return request('/fss/FundValue/LastTrade', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function updateLastTrade(param) {
  return request('/fss/FundValue/UpdateFundTwoUBSInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function insert() {
  return request('/fss/FundValue/MakeTodayFundInfo', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function insertValueChart() {
  return request('/fss/FundValue/InsertValueChart', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getCodeList(param) {
  return request('/fss/Report/CodeList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getSearchByCode(param) {
  return request(`/fss/Report/SearchByCode?code=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

// fourfunds
export async function getFundFourValueStock(param) {
  return request(`/fss/FundFourValue/Stock?date=${param.date}` || '', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getMakeTodayInfo(param) {
  return request('/fss/FundFourValue/MakeTodayInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function clear(param) {
  return request('/fss/FundFourValue/Clear', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function makeTodayInfoByTrade(param) {
  return request('/fss/FundFourValue/MakeTodayInfoByTrade', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function updateStockUpdateInfo(param) {
  return request('/fss/FundFourValue/StockUpdateInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function getFundFourValueOption(param) {
  return request(`/fss/FundFourValue/Option?date=${param.date}` || '', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function getOptionSyncLastTradeInfo(param) {
  return request('/fss/FundFourValue/OptionSyncLastTradeInfo', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getTradeList(param) {
  return request('/fss/FundFourValue/GetTradeList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function optionTradeInfoUpdate(param) {
  return request('/fss/FundFourValue/OptionTradeInfoUpdate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function optionClosePosition(param) {
  return request('/fss/FundFourValue/OptionClosePosition', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function getOptionCreateTodayList(param) {
  return request('/fss/FundFourValue/OptionCreateTodayList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getWorth(param) {
  console.log(param);
  return request(`/fss/FundFourValue/GetWorth?date=${param.date}` || '', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function insertWorth(param) {
  return request('/fss/FundFourValue/InsertWorth', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getStockHistory(param) {
  return request('/fss/FundFourValue/GetStockHistory', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getOptionHistory(param) {
  return request('/fss/FundFourValue/GetOptionHistory', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getMonthWorth(param) {
  return request(`/fss/FundFourValue/GetMonthWorth?date=${param.date}` || '', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getFundLastDayInfo(param) {
  return request(`/fss/FundFourValue/GetFundLastDayInfo?date=${param.date}` || '', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function commitImage(param) {
  return request('/fss/FundFourValue/Image', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function getDateList(param) {
  return request('/fss/FundFourValue/GetDateList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function getHistory(param) {
  return request('/fss/CustomizeEtfCompose/GetHistory', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getHot(param) {
  return request('/fss/CustomizeEtfCompose/GetHot', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getNormal(param) {
  return request('/fss/CustomizeEtfCompose/GetNormal', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getHistoryByType(param) {
  return request(`/fss/CustomizeEtfCompose/GetHistoryByType?type=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getStockHistoryRunPoint(param) {
  return request(`/fss/RunPoint/StockHistoryRunPoint?stock=${param.stock}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getStockRunPoint(param) {
  return request(`/fss/Kline/GetStockRunPoint?code=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getCoordinatesSignal(param) {
  return request('/fss/CoordinatesSignal/TodayList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function updateCoordinatesSignal(param) {
  return request('/fss/CoordinatesSignal/Update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function updateOptionFlag(param) {
  return request('/fss/FundValue/UpdateOptionFlag', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function syncLastOptionTradeInfo() {
  return request('/fss/FundValue/SyncLastOptionTradeInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getLastDayOptionList() {
  return request('/fss/FundValue/LastDayOptionList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getTodayTradeList() {
  return request('/fss/FundValue/TodayTradeList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function makeOptionTodayInfo() {
  return request('/fss/FundValue/MakeOptionTodayInfo', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getStockList(param) {
  return request(`/fss/Fund2PlanStock/StockList?date=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function addStock(param) {
  return request(`/fss/Fund2PlanStock/AddStock?code=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function deleteStock(param) {
  return request(`/fss/Fund2PlanStock/Del?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getFund2PlanStockDateList() {
  return request('/fss/Fund2PlanStock/DateList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getBonds(param) {
  return request('/fss/Bond/BondList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function editBonds(param) {
  return request('/fss/Bond/BondReset', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function removeBonds(param) {
  return request('/fss/Bond/BondRemove', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function addBonds(param) {
  return request('/fss/Bond/BondAdd', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function getAQDQ() {
  return request('/fss/Aqdq/AqdqList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function delAQDQ(param) {
  return request('/fss/Aqdq/AqdqRemove', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function addAQDQ(param) {
  return request('/fss/Aqdq/AqdqAdd', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function updateAQDQ(param) {
  return request('/fss/Aqdq/AqdqReset', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function delDQ(param) {
  return request('/fss/AqdqMonitor/DqMonitorRemove', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function getDQ() {
  return request('/fss/AqdqMonitor/DqMonitorList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function addDQ(param) {
  return request('/fss/AqdqMonitor/DqMonitorAdd', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function billDataExport() {
  return request('/fss/CxBill/BillDataExport', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

// lasttrade
export async function getLastTradeList() {
  return request('/fss/BankTradeSummaryInfo/OptionTradeList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getCpbLastPosition() {
  return request('/fss/BankTradeSummaryInfo/CpbLastPosition', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function addCtbOptionTrade(param) {
  return request('/fss/BankTradeSummaryInfo/AddCtbOptionTrade', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
export async function synchronization() {
  return request('/fss/BankTradeSummaryInfo/UbsSynchronization', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function delCpbOptionTrade(param) {
  return request(`/fss/BankTradeSummaryInfo/DelCpbOptionTrade?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function stockTradeList() {
  return request('/fss/BankTradeSummaryInfo/StockTradeList', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function stockDelTrade(param) {
  return request(`/fss/BankTradeSummaryInfo/StockDelTrade?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function getAllLastOptionPosition() {
  return request('/fss/BankTradeSummaryInfo/AllLastOptionPosition', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}
export async function updateOptionExercise(param) {
  return request('/fss/BankTradeSummaryInfo/OptionExercise', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function stockAddTrade(param) {
  return request('/fss/BankTradeSummaryInfo/StockAddTrade', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function stockConfirm(param) {
  return request('/fss/BankTradeSummaryInfo/StockConfirm', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

// updateTrade
export async function updateOptionTrade(param) {
  return request('/fss/BankTradeSummaryInfo/UpdateOptionTrade', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function stockUpdateTrade(param) {
  return request('/fss/BankTradeSummaryInfo/StockUpdateTrade', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

// eslint-disable-next-line no-unused-vars
export async function getGeneratePosition(param) {
  return request('/fss/BankTradeSummaryInfo/GeneratePosition', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

// eslint-disable-next-line no-unused-vars
export async function getGenerateFundWorth(param) {
  return request('/fss/BankTradeSummaryInfo/GenerateFundWorth', {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function getStockTradeLogList(param) {
  return request(
    param
      ? `/fss/BankTradeSummaryInfo/StockTradeLogListAdmin
?date=${param.date || ''}&stock=${param.stock ||
          ''}`
      : `/fss/BankTradeSummaryInfo/StockTradeLogListAdmin
`,
    {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json;charset=utf-8',
      },
    }
  );
}

export async function reviseSummary(param) {
  return request('/fss/BankTradeSummaryInfo/ReviseSummary', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}

export async function reviseState(param) {
  return request(`/fss/BankTradeSummaryInfo/ReviseState?id=${param}`, {
    method: 'GET',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
  });
}

export async function addSummary(param) {
  return request('/fss/BankTradeSummaryInfo/AddSummaryLog', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
    },
    body: JSON.stringify(param),
  });
}
